<template>
  <el-drawer
    :append-to-body="true"
    :visible.sync="dialogVisible"
    :before-close="close"
    class="drawer-panel"
    :title="title"
    v-bind="$attrs"
  >
    <slot></slot>
  </el-drawer>
</template>

<script>
export default {
  name: 'DrawerPanel',
  props: {
    title: {
      type: String,
      default: ''
    },
    value: {
      type: Boolean,
      default: false
    }
  },
  data() {
    return {
      dialogVisible: this.value
    }
  },
  methods: {
    open() {
      this.dialogVisible = false
    },
    close() {
      this.dialogVisible = false
      this.visible = false
      this.$emit('input', false)
    }
  },
  watch: {
    value(val) {
      this.dialogVisible = val
    }
  }
}
</script>

<style scoped></style>
